

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/fluid.png">
  <link rel="icon" href="/img/fluid.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="hgc">
  <meta name="keywords" content="">
  
    <meta name="description" content="写个爬虫来爬取顶会的论文">
<meta property="og:type" content="article">
<meta property="og:title" content="爬取EMNLP上的论文">
<meta property="og:url" content="http://example.com/2024/03/14/%E7%88%AC%E5%8F%96EMNLP%E4%B8%8A%E7%9A%84%E8%AE%BA%E6%96%87/index.html">
<meta property="og:site_name" content="hgc&#39;s Blog">
<meta property="og:description" content="写个爬虫来爬取顶会的论文">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://example.com/img/Blog.png">
<meta property="article:published_time" content="2024-03-14T06:30:24.000Z">
<meta property="article:modified_time" content="2024-03-14T09:50:15.168Z">
<meta property="article:tag" content="python">
<meta property="article:tag" content="爬虫">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="http://example.com/img/Blog.png">
  
  
  
  <title>爬取EMNLP上的论文 - hgc&#39;s Blog</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/css/highlight.css" />
  
    <link id="highlight-css-dark" rel="stylesheet" href="/css/highlight-dark.css" />
  




  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"example.com","root":"/","version":"1.9.7","typing":{"enable":true,"typeSpeed":90,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"right","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":true,"follow_dnt":true,"baidu":"afa27b3408bbab372d2b3aba487978e4","google":{"measurement_id":"G-846D3FPCR6"},"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":"ExOr1FY8NzdDhfdZvDw9D5c2-gzGzoHsz","app_key":"k7IRTVgwpZstqPIhmLpn9lvL","server_url":"https://exor1fy8.lc-cn-n1-shared.com","path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml","include_content_in_search":true};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
  

  
    <!-- Baidu Analytics -->
    <script async>
      if (!Fluid.ctx.dnt) {
        var _hmt = _hmt || [];
        (function() {
          var hm = document.createElement("script");
          hm.src = "https://hm.baidu.com/hm.js?afa27b3408bbab372d2b3aba487978e4";
          var s = document.getElementsByTagName("script")[0];
          s.parentNode.insertBefore(hm, s);
        })();
      }
    </script>
  

  
    <!-- Google tag (gtag.js) -->
    <script async>
      if (!Fluid.ctx.dnt) {
        Fluid.utils.createScript("https://www.googletagmanager.com/gtag/js?id=G-846D3FPCR6", function() {
          window.dataLayer = window.dataLayer || [];
          function gtag() {
            dataLayer.push(arguments);
          }
          gtag('js', new Date());
          gtag('config', 'G-846D3FPCR6');
        });
      }
    </script>
  

  

  

  

  
    
  



  
<meta name="generator" content="Hexo 7.1.1"></head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 70vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>hgcheng&#39;s blog</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/" target="_self">
                <i class="iconfont icon-home-fill"></i>
                <span>首页</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/" target="_self">
                <i class="iconfont icon-archive-fill"></i>
                <span>归档</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/" target="_self">
                <i class="iconfont icon-category-fill"></i>
                <span>分类</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/" target="_self">
                <i class="iconfont icon-tags-fill"></i>
                <span>标签</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/" target="_self">
                <i class="iconfont icon-user-fill"></i>
                <span>关于</span>
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              <i class="iconfont icon-search"></i>
            </a>
          </li>
          
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">
              <i class="iconfont icon-dark" id="color-toggle-icon"></i>
            </a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('/img/banner1.jpg') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="爬取EMNLP上的论文"></span>
          
        </div>

        
          
  <div class="mt-3">
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2024-03-14 14:30" pubdate>
          2024年3月14日 下午
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          660 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          6 分钟
        
      </span>
    

    
    
      
        <span id="leancloud-page-views-container" class="post-meta" style="display: none">
          <i class="iconfont icon-eye" aria-hidden="true"></i>
          <span id="leancloud-page-views"></span> 次
        </span>
        
      
    
  </div>


        
      </div>

      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      

    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <h1 id="seo-header">爬取EMNLP上的论文</h1>
            
              <p id="updated-time" class="note note-info" style="display: none">
                
                  
                    本文最后更新于 2024-03-14T17:50:15+08:00
                  
                  

                
              </p>
            
            
              <div class="markdown-body">
                
                <h1>前言</h1>
<blockquote>
<p>最近老师要求找出ACL和EMNLP上面所有的有关图像的论文，所以网上找了点代码，改一改，爬取和筛选处理出我所需要的paper</p>
</blockquote>
<h2 id="爬取ACL会议short类型的paper">爬取ACL会议short类型的paper</h2>
<p>可变参数：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs python">year = <span class="hljs-built_in">str</span>(<span class="hljs-number">2023</span>)<br>contents = <span class="hljs-string">&#x27;acl&#x27;</span><br>content_type = <span class="hljs-string">&#x27;short&#x27;</span><br></code></pre></td></tr></table></figure>
<p>完整代码：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br></pre></td><td class="code"><pre><code class="hljs python"><span class="hljs-comment"># 请求成功</span><br><span class="hljs-keyword">if</span> main_resp.status_code == <span class="hljs-number">200</span>:<br>    <span class="hljs-comment"># 将网页源码构造成BeautifulSoup对象，方便操作</span><br>    main_bsobj = BeautifulSoup(main_resp.content, <span class="hljs-string">&#x27;lxml&#x27;</span>)<br>    main_list = main_bsobj.find_all(<span class="hljs-string">&#x27;a&#x27;</span>)  <span class="hljs-comment"># 获取所有的a标签对象</span><br>    index = <span class="hljs-number">1</span><br><br>    <span class="hljs-keyword">with</span> <span class="hljs-built_in">open</span>(contents + year + content_type + <span class="hljs-string">&#x27;_data.csv&#x27;</span>, <span class="hljs-string">&#x27;w&#x27;</span>, encoding=<span class="hljs-string">&#x27;utf-8&#x27;</span>) <span class="hljs-keyword">as</span> f:<br>        f.write(<span class="hljs-string">&#x27;S/N,PDF,Title,Abstract\n&#x27;</span>)<br><br>        <span class="hljs-keyword">for</span> main <span class="hljs-keyword">in</span> main_list:<br>            urlmain = main.get(<span class="hljs-string">&quot;href&quot;</span>)<br>            <span class="hljs-comment"># PDF</span><br>            <span class="hljs-comment"># https://aclanthology.org/2023.acl-long.910.pdf</span><br>            <span class="hljs-keyword">if</span> urlmain.startswith(<span class="hljs-string">&#x27;https://aclanthology.org/&#x27;</span> + year +<br>                                  <span class="hljs-string">&#x27;.&#x27;</span> + contents + <span class="hljs-string">&#x27;-&#x27;</span> + content_type + <span class="hljs-string">&#x27;.&#x27;</span>):<br>                <span class="hljs-comment"># 剔除没用的pdf</span><br>                <span class="hljs-keyword">if</span> urlmain.endswith(<span class="hljs-string">&#x27;.0.pdf&#x27;</span>) <span class="hljs-keyword">or</span> urlmain.endswith(<span class="hljs-string">&#x27;.report.pdf&#x27;</span>):<br>                    <span class="hljs-keyword">continue</span><br>                <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Processing:&quot;</span>, urlmain)<br>                <span class="hljs-comment"># 写入序号</span><br>                f.write(<span class="hljs-built_in">str</span>(index) + <span class="hljs-string">&quot;,&quot;</span>)<br>                index += <span class="hljs-number">1</span><br>                pdf = urlmain<br>                <span class="hljs-comment"># 写入pdf的url</span><br>                f.write(pdf + <span class="hljs-string">&quot;,&quot;</span>)<br>                <span class="hljs-comment"># 抽取abs和title</span><br>                paper_path = urlmain.replace(<span class="hljs-string">&#x27;.pdf&#x27;</span>, <span class="hljs-string">&#x27;&#x27;</span>)<br><br>                <span class="hljs-comment"># 网络不稳定导致请求失败 设置重试</span><br>                retries = <span class="hljs-number">10</span>  <span class="hljs-comment"># 设置最大重试次数</span><br>                <span class="hljs-keyword">for</span> attempt <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(retries):<br>                    <span class="hljs-keyword">try</span>:<br>                        paper_res = requests.get(paper_path)<br>                        paper_res.raise_for_status()<br>                        <span class="hljs-keyword">if</span> paper_res.status_code == <span class="hljs-number">200</span>:<br>                            paper_info = BeautifulSoup(paper_res.content, <span class="hljs-string">&#x27;lxml&#x27;</span>)<br>                            paper_list = paper_info.find_all(<span class="hljs-string">&#x27;pre&#x27;</span>)<br>                            <span class="hljs-keyword">for</span> paper <span class="hljs-keyword">in</span> paper_list:<br>                                paper = <span class="hljs-built_in">str</span>(paper)<br>                                <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Raw Paper Content:&quot;</span>, paper)<br>                                title_span = re.search(<span class="hljs-string">&#x27;title = &#x27;</span>, paper)<br>                                author_span = re.search(<span class="hljs-string">&#x27;author = &#x27;</span>, paper)<br>                                title = regularization(<span class="hljs-built_in">str</span>(<br>                                    paper[title_span.end():author_span.start() - <span class="hljs-number">6</span>]))<br>                                <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Title:&quot;</span>, title)<br>                                f.write(title + <span class="hljs-string">&quot;,&quot;</span>)<br><br>                                abstract_span = re.search(<span class="hljs-string">&#x27;abstract = &#x27;</span>, paper)<br>                                pre_span = re.search(<span class="hljs-string">&#x27;&lt;/pre&gt;&#x27;</span>, paper)<br>                                abstract = regularization(<span class="hljs-built_in">str</span>(<br>                                    paper[abstract_span.end():pre_span.start() - <span class="hljs-number">4</span>]))<br>                                <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Abstract:&quot;</span>, abstract)<br>                                f.write(abstract + <span class="hljs-string">&quot;\n&quot;</span>)<br>                                <span class="hljs-keyword">break</span><br>                    <span class="hljs-keyword">except</span> requests.exceptions.RequestException <span class="hljs-keyword">as</span> e:<br>                        <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Error: <span class="hljs-subst">&#123;e&#125;</span>&quot;</span>)<br>                        <span class="hljs-keyword">if</span> attempt &lt; retries - <span class="hljs-number">1</span>:<br>                            <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Retrying in 5 seconds... (Attempt <span class="hljs-subst">&#123;attempt + <span class="hljs-number">1</span>&#125;</span>/<span class="hljs-subst">&#123;retries&#125;</span>)&quot;</span>)<br>                            time.sleep(<span class="hljs-number">5</span>)<br>                        <span class="hljs-keyword">else</span>:<br>                            <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Max retries reached. Skipping...&quot;</span>)<br>                            <span class="hljs-keyword">break</span><br>                    <span class="hljs-keyword">finally</span>:<br>                        <span class="hljs-keyword">if</span> <span class="hljs-string">&#x27;paper_res&#x27;</span> <span class="hljs-keyword">in</span> <span class="hljs-built_in">locals</span>() <span class="hljs-keyword">and</span> paper_res <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> <span class="hljs-literal">None</span>:<br>                            paper_res.close()<br></code></pre></td></tr></table></figure>
<p>爬取完成之后，有脏数据，如下图：</p>
<img src="/2024/03/14/%E7%88%AC%E5%8F%96EMNLP%E4%B8%8A%E7%9A%84%E8%AE%BA%E6%96%87/image-20240314170446951.png" srcset="/img/loading.gif" lazyload class="" title="image-20240314170446951">
<p>所以做一下数据过滤：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><code class="hljs python"><span class="hljs-keyword">with</span> <span class="hljs-built_in">open</span>(input_file, <span class="hljs-string">&#x27;r&#x27;</span>, encoding=<span class="hljs-string">&#x27;utf-8&#x27;</span>) <span class="hljs-keyword">as</span> infile, <span class="hljs-built_in">open</span>(output_file, <span class="hljs-string">&#x27;w&#x27;</span>, encoding=<span class="hljs-string">&#x27;utf-8&#x27;</span>,<br>                                                             newline=<span class="hljs-string">&#x27;&#x27;</span>) <span class="hljs-keyword">as</span> outfile:<br>    reader = csv.reader(infile)<br>    header = <span class="hljs-built_in">next</span>(reader)  <span class="hljs-comment"># 读取头部信息</span><br>    index_col = header.index(<span class="hljs-string">&#x27;S/N&#x27;</span>)  <span class="hljs-comment"># 找到编号列的索引</span><br><br>    <span class="hljs-comment"># 写入头部</span><br>    writer = csv.writer(outfile)<br>    writer.writerow(header)<br><br>    <span class="hljs-comment"># 过滤并写入数据</span><br>    <span class="hljs-keyword">for</span> row <span class="hljs-keyword">in</span> reader:<br>        <span class="hljs-keyword">if</span> row[index_col].isdigit():  <span class="hljs-comment"># 检查编号是否为数字</span><br>            writer.writerow(row)<br></code></pre></td></tr></table></figure>
<p>如下图，ACL-short 的paper共有164篇：</p>
<img src="/2024/03/14/%E7%88%AC%E5%8F%96EMNLP%E4%B8%8A%E7%9A%84%E8%AE%BA%E6%96%87/image-20240314171006726.png" srcset="/img/loading.gif" lazyload class="" title="image-20240314171006726">
<p>写个数据处理，把跟 “image” 有关的追加到我之前的文件中：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><code class="hljs python"><span class="hljs-keyword">import</span> csv<br><br><span class="hljs-comment"># 读取 CSV 文件</span><br>input_file = <span class="hljs-string">&#x27;acl2023short.csv&#x27;</span><br>output_file = <span class="hljs-string">&#x27;image_article.csv&#x27;</span><br><br><br><span class="hljs-keyword">def</span> <span class="hljs-title function_">main</span>():<br>    <span class="hljs-keyword">with</span> <span class="hljs-built_in">open</span>(input_file, <span class="hljs-string">&#x27;r&#x27;</span>, encoding=<span class="hljs-string">&#x27;utf-8&#x27;</span>) <span class="hljs-keyword">as</span> infile, <span class="hljs-built_in">open</span>(output_file, <span class="hljs-string">&#x27;a&#x27;</span>, encoding=<span class="hljs-string">&#x27;utf-8&#x27;</span>,<br>                                                                 newline=<span class="hljs-string">&#x27;&#x27;</span>) <span class="hljs-keyword">as</span> outfile:<br>        reader = csv.reader(infile)<br>        header = <span class="hljs-built_in">next</span>(reader)  <span class="hljs-comment"># 读取头部信息</span><br>        title_col = header.index(<span class="hljs-string">&#x27;Title&#x27;</span>)  <span class="hljs-comment">#</span><br><br>        <span class="hljs-comment"># 写入头部</span><br>        writer = csv.writer(outfile)<br>        writer.writerow(header)<br><br>        <span class="hljs-comment"># 过滤并写入数据</span><br>        <span class="hljs-keyword">for</span> row <span class="hljs-keyword">in</span> reader:<br>            <span class="hljs-keyword">if</span> <span class="hljs-string">&quot;image&quot;</span> <span class="hljs-keyword">not</span> <span class="hljs-keyword">in</span> row[title_col].lower():<br>                <span class="hljs-keyword">continue</span><br>            writer.writerow(row)<br><br><br><span class="hljs-keyword">if</span> __name__ == <span class="hljs-string">&#x27;__main__&#x27;</span>:<br>    main()<br></code></pre></td></tr></table></figure>
<img src="/2024/03/14/%E7%88%AC%E5%8F%96EMNLP%E4%B8%8A%E7%9A%84%E8%AE%BA%E6%96%87/image-20240314174552602.png" srcset="/img/loading.gif" lazyload class="" title="image-20240314174552602">
<p>爬取EMNLP会议的paper方法如出一辙，这里不再赘述。</p>

                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
    <div class="post-meta mr-3 d-flex align-items-center">
      <i class="iconfont icon-category"></i>
      

<span class="category-chains">
  
  
    
      <span class="category-chain">
        
  <a href="/categories/python/" class="category-chain-item">python</a>
  
  

      </span>
    
  
</span>

    </div>
  
  
    <div class="post-meta">
      <i class="iconfont icon-tags"></i>
      
        <a href="/tags/python/" class="print-no-link">#python</a>
      
        <a href="/tags/%E7%88%AC%E8%99%AB/" class="print-no-link">#爬虫</a>
      
    </div>
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>爬取EMNLP上的论文</div>
      <div>http://example.com/2024/03/14/爬取EMNLP上的论文/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>hgc</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2024年3月14日</div>
        </div>
      
      
      
        <div class="license-meta-item">
          <div>许可协议</div>
          <div>
            
              
              
                <a class="print-no-link" target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
                  <span class="hint--top hint--rounded" aria-label="BY - 署名">
                    <i class="iconfont icon-by"></i>
                  </span>
                </a>
              
            
          </div>
        </div>
      
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2024/03/19/2024%E6%B3%B0%E8%BF%AA%E6%9D%AF%E6%95%B0%E6%8D%AE%E6%8C%96%E6%8E%98%E6%AF%94%E8%B5%9BB%E9%A2%98%E5%A4%87%E6%88%98/" title="2024泰迪杯数据挖掘比赛B题备战">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">2024泰迪杯数据挖掘比赛B题备战</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2024/03/06/%E5%90%B4%E6%81%A9%E8%BE%BE%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/" title="吴恩达机器学习笔记">
                        <span class="hidden-mobile">吴恩达机器学习笔记</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
  
  
    <article id="comments" lazyload>
      
  <div id="valine"></div>
  <script type="text/javascript">
    Fluid.utils.loadComments('#valine', function() {
      Fluid.utils.createScript('https://lib.baomitu.com/valine/1.5.1/Valine.min.js', function() {
        var options = Object.assign(
          {"appId":"ExOr1FY8NzdDhfdZvDw9D5c2-gzGzoHsz","appKey":"k7IRTVgwpZstqPIhmLpn9lvL","path":"window.location.pathname","placeholder":null,"avatar":"retro","meta":["nick","mail","link"],"requiredFields":[],"pageSize":10,"lang":"zh-CN","highlight":false,"recordIP":false,"serverURLs":"","emojiCDN":null,"emojiMaps":null,"enableQQ":false},
          {
            el: "#valine",
            path: window.location.pathname
          }
        )
        new Valine(options);
        Fluid.utils.waitElementVisible('#valine .vcontent', () => {
          var imgSelector = '#valine .vcontent img:not(.vemoji)';
          Fluid.plugins.imageCaption(imgSelector);
          Fluid.plugins.fancyBox(imgSelector);
        })
      });
    });
  </script>
  <noscript>Please enable JavaScript to view the comments</noscript>


    </article>
  


          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="margin-left: -1rem">
    <div id="toc">
  <p class="toc-header">
    <i class="iconfont icon-list"></i>
    <span>目录</span>
  </p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
       <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
	  <!--《添加网站运行时间 -->
<br/>

<span id="timeDate">载入天数...</span><span id="times">载入时分秒...</span>
<script>
var now = new Date(); 

function createtime() {
    //此处修改你的建站时间或者网站上线时间
    var grt = new Date('02/07/2024 8:00:00');
    now.setTime(now.getTime() + 250);
    days = (now - grt) / 1000 / 60 / 60 / 24;

    dnum = Math.floor(days);
    hours = (now - grt) / 1000 / 60 / 60 - (24 * dnum);
    hnum = Math.floor(hours);
    if (String(hnum).length == 1) {
        hnum = "0" + hnum;
    }
    minutes = (now - grt) / 1000 / 60 - (24 * 60 * dnum) - (60 * hnum);
    mnum = Math.floor(minutes);
    if (String(mnum).length == 1) {
        mnum = "0" + mnum;
    }
    seconds = (now - grt) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum);
    snum = Math.round(seconds);
    if (String(snum).length == 1) {
        snum = "0" + snum;
    }
    document.getElementById("timeDate").innerHTML = " 本小站已卧薪尝胆 " + dnum + " 天 ";
    document.getElementById("times").innerHTML = hnum + " 小时 " + mnum + " 分 " + snum + " 秒";
}
setInterval("createtime()", 250);
</script>

<!-- 添加网站运行时间》-->

    </div>
  
  
    <div class="statistics">
  
  

  
    
      <span id="leancloud-site-pv-container" style="display: none">
        总访问量 
        <span id="leancloud-site-pv"></span>
         次
      </span>
    
    
      <span id="leancloud-site-uv-container" style="display: none">
        总访客数 
        <span id="leancloud-site-uv"></span>
         人
      </span>
    
    

  
</div>

  
  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.4/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>




  
    <script  src="/js/img-lazyload.js" ></script>
  




  
<script>
  var relativeDate = function() {
    var updatedTime = document.getElementById('updated-time');
    if (updatedTime) {
      var text = updatedTime.textContent;
      var reg = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:Z|[+-]\d{2}:\d{2})/;
      var matchs = text.match(reg);
      if (matchs) {
        var relativeTime = moment(matchs[0]).fromNow();
        updatedTime.textContent = text.replace(reg, relativeTime);
      }
      updatedTime.style.display = '';
    }
  };
  Fluid.utils.createScript('https://lib.baomitu.com/moment.js/2.29.4/moment.min.js', function() {
    if (!'zh-cn'.startsWith('en')) {
      Fluid.utils.createScript('https://lib.baomitu.com/moment.js/2.29.4/locale/zh-cn.min.js', function() {
        relativeDate();
      });
    } else {
      relativeDate();
    }
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.20.1/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init(Object.assign({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      scrollSmooth    : true,
      includeTitleTags: true,
      headingsOffset  : -boardTop,
    }, CONFIG.toc));
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }

    Fluid.events.registerRefreshCallback(function() {
      if ('tocbot' in window) {
        tocbot.refresh();
        var toc = jQuery('#toc');
        if (toc.length === 0 || !tocbot) {
          return;
        }
        if (toc.find('.toc-list-item').length > 0) {
          toc.css('visibility', 'visible');
        }
      }
    });
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.11/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));

    Fluid.events.registerRefreshCallback(function() {
      if ('anchors' in window) {
        anchors.removeAll();
        var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
        var res = [];
        for (var item of el) {
          res.push('.markdown-body > ' + item.trim());
        }
        if (CONFIG.anchorjs.placement === 'left') {
          anchors.options.class = 'anchorjs-link-left';
        }
        anchors.add(res.join(', '));
      }
    });
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script defer src="/js/leancloud.js" ></script>

  <script  src="/js/local-search.js" ></script>





<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/","tagMode":false});</script></body>
</html>
